package com.dingpeikeji.quickdeer.modules.rentproduct.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dingpeikeji.quickdeer.core.common.persistence.Page;
import com.dingpeikeji.quickdeer.core.modules.orders.entity.TOrders;
import com.dingpeikeji.quickdeer.modules.rentproduct.dao.RentproductInvoiceDao;

@Service
@Transactional(readOnly = true)
public class RentproductInvoiceService {
	
	@Autowired
	private RentproductInvoiceDao dao;
	
	// 整车订单列表
	public Page<TOrders> findOrderWithRentproductPage(Page<TOrders> page, TOrders orders){
		String ordertype = "("+TOrders.ORDER_TYPE_RENTPRODUCT_DAY+","+
				TOrders.ORDER_TYPE_RENTPRODUCT_TRAVEL+")";
		orders.setIscheck("N");
		orders.setOrderstatus(TOrders.STATUS_PAY);
		orders.setOrdertype(ordertype);
		orders.setPage(page);
		page.setList(dao.findOrderWithRentproductList(orders));
		return page;
	}
		
	// 开票
	public boolean updateCheck(TOrders orders){
		if(dao.updateCheck(orders)>0){
			return true;
		} else {
			return false;
		}
	}
}
